/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.plan.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.javaeye.common.util.ListUtil;
import com.javaeye.plan.dto.InStoreVoucher;

public class VoucherInStoreAction extends InStoreVoucherAction {
	
	protected static Log log = LogFactory.getLog(VoucherInStoreAction.class); 
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3216585574200112708L;
	
	public String queryVoucherWaitInStoreList() throws Exception {
		setDepartmentList(ListUtil.baseCodeList(codeService, ListUtil.UNIT_CODE_DEPATMENT));
		VoucherCondition condition = getCondition();
		condition.setStatus(InStoreVoucher.VOUCHES_STATES_CHECKED);
		setVoucherList(service.getVoucherList(condition, getPageInfo()));
		return SUCCESS;
	}
	
	public String queryVoucherForInStore() throws Exception {
		setVoucher(service.getInStoreVoucher(getVoucherId()));
		return SUCCESS;
	}
	
	public String saveVoucherInStoreResult() throws Exception {
		String voucherId = getVoucherId();
		InStoreVoucher voucher = service.getInStoreVoucher(voucherId);
		service.saveInStoreVoucher(voucher);
		return SUCCESS;
	}
	
}
